import java.awt.EventQueue;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.sql.SQLException;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.UIManager;
import javax.swing.UIManager.LookAndFeelInfo;
import javax.swing.border.EmptyBorder;




public class Stundenrechner extends JFrame {

	private static final long serialVersionUID = 1L;
	private JPanel contentPane;
	//private static JFrame Start = new JFrame();
	private static Stundenrechner Start = new Stundenrechner();
	
	/**
	 * Launch the application.
	 */
	public static void main(String[] args) {
		EventQueue.invokeLater(new Runnable() {
			public void run() {
				try {
					Start.repaint();
					Start.setVisible(true);
				} catch (Exception e) {
					e.printStackTrace();
				}
				
			}
		});
	}

	/**
	 * Create the frame.
	 */
	public Stundenrechner() {
		
		try {
		    for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
		        if ("Nimbus".equals(info.getName())) {
		            UIManager.setLookAndFeel(info.getClassName());
		            break;
		        }
		    }
		} catch (Exception e) {
		    // If Nimbus is not available, you can set the GUI to another look and feel.
		}
		
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setBounds(100, 100, 400, 320);
		contentPane = new JPanel();
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		setContentPane(contentPane);
		
		JButton btnStundenHinzufgen = new JButton("Stunden hinzuf\u00FCgen");
		btnStundenHinzufgen.setBounds(116, 6, 160, 38);
		
		btnStundenHinzufgen.addActionListener(new ActionListener() {
			@SuppressWarnings("deprecation")
			public void actionPerformed(ActionEvent e) {
				Start.setContentPane(new Stundenhinzu());
				Start.validate();
			}
		});
		contentPane.setLayout(null);
		contentPane.add(btnStundenHinzufgen);
		
		JButton btnStundenAnzeigen = new JButton("Stunden anzeigen");
		btnStundenAnzeigen.setBounds(116, 161, 160, 38);
		btnStundenAnzeigen.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				
				 try {
					Start.setContentPane(new Stundenanzeigen());
				} catch (SQLException e1) {
					// TODO Automatisch generierter Erfassungsblock
					e1.printStackTrace();
				}
				 Start.validate();
				  
				 
			}
		});
		contentPane.add(btnStundenAnzeigen);
		
		JButton btnAuftragHinzufgen = new JButton("Auftrag hinzuf\u00FCgen");
		btnAuftragHinzufgen.setBounds(116, 111, 160, 38);
		btnAuftragHinzufgen.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
				Start.setContentPane(new Auftraghinzu());
				Start.validate();
			}
		});
		contentPane.add(btnAuftragHinzufgen);
		
		JButton btnBeenden = new JButton("Beenden");
		btnBeenden.setBounds(137, 211, 117, 29);
		btnBeenden.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
				System.exit(0);
			}
		});
		contentPane.add(btnBeenden);
		
		JButton btnMitarbeiterHinzufgen = new JButton("Mitarbeiter hinzuf\u00FCgen");
		btnMitarbeiterHinzufgen.setBounds(116, 56, 160, 43);
		btnMitarbeiterHinzufgen.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
				Start.setContentPane(new MitarbeiterHinzu());
				Start.validate();
			}
		});
		contentPane.add(btnMitarbeiterHinzufgen);
	}

	public static JFrame getStart() {
		return Start;
	}

	public static void setStart(JFrame start) {
		Start = Start;
		Connector.connection_start();
	}
}
